import {
  createRouter,
  createWebHashHistory
} from 'vue-router';
import Layout from '../Layout/index.vue';

export const constantRoutes = [
  {
    path: '/',
    component: Layout,
    name: 'Layout',
    children: [{
      path: '/home',
      name: 'Home',
      component: () => import(/* webpackChunkName: "about" */ '@/views/Home/index.vue'),
      meta: {
        title: '首页',
        icon: 'home'
      }
    }, {
      path: '/goods',
      name: 'Goods',
      component: () => import(/* webpackChunkName: "about" */ '../views/Goods'),
      meta: {
        title: '商品管理',
        icon: 'goods'
      },
      children: [
        {
          path: 'list',
          name: 'GoodsList',
          component: () => import(/* webpackChunkName: "about" */ '../views/Goods/List'),
          meta: {
            title: '商品列表'
          }
        },
        {
          path: 'lists',
          name: 'GoodsLists',
          component: () => import(/* webpackChunkName: "about" */ '../views/Goods/List'),
          meta: {
            title: '商品列表s'
          }
        }
      ]
    }]
  },
  {
    path: '/login',
    name: 'Login',
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: () => import(/* webpackChunkName: "about" */ '../views/Login')
  },
  {
    path: '/:pathMatch(.*)',
    name: '404',
    component: () => import(/* webpackChunkName: "about" */ '@/views/404.vue')
  }
];

export const asyncRoutes = [
];

const router = createRouter({
  history: createWebHashHistory(),
  routes: constantRoutes
});

export default router;
